package com.zhongxiangspace.service.impl;

import com.zhongxiangspace.entity.House;
import com.zhongxiangspace.entity.QueryAnalyzer;
import com.zhongxiangspace.entity.VO.QueryAnalyzerOffice;
import com.zhongxiangspace.mapper.HouseMapper;
import com.zhongxiangspace.service.HouseService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

import java.util.List;
import java.util.Map;

/**
 * 房源
 */
@Service
public class HoueseServiceImpl implements HouseService {

    @Autowired
    private HouseMapper houseMapper;

    /**
     * @param house
     * @return
     * @ 插入数据
     */
    @Override
    @Transactional
    public boolean inster(House house) {
        return this.houseMapper.inster(house);
    }

    /**
     * 获取data
     *
     * @param queryAnalyzer
     * @return
     */
    @Override
    public List<Map<String, Object>> queryAll(QueryAnalyzer queryAnalyzer) {
        return this.houseMapper.queryAll(queryAnalyzer);
    }

    /**
     * 删除
     *
     * @param id
     * @return
     */
    @Override
    @Transactional
    public boolean delete(Integer id) {
        return this.houseMapper.delete(id);
    }

    /**
     * 获取单条
     *
     * @param id
     * @return
     */
    @Override
    public House queryOne(Integer id) {
        return this.houseMapper.queryOne(id);
    }

    /**
     * 更新 data
     *
     * @param house
     * @return
     */
    @Override
    public boolean updata(House house) {
        return this.houseMapper.updata(house);
    }

    @Override
    public List<House> queryBHList(QueryAnalyzerOffice queryAnalyzerOffice) {
        return this.houseMapper.queryBHList(queryAnalyzerOffice);
    }

    /**
     * 精选房源
     * @param queryAnalyzerOffice
     * @return
     */
    @Override
    public List<Map<String, Object>> queryAllhouse(QueryAnalyzerOffice queryAnalyzerOffice) {
        return this.houseMapper.queryAllhouse(queryAnalyzerOffice);
    }
}
